package com.coin900.coin.service.coin;

import com.coin900.coin.persist.coin.CoinTokenCoinVO;
import com.value.mybatis.IDaoRouter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 代币和币的换算比例
 *
 * @author shui
 * @create 2018-1-24
 */
@Service
public class CoinTokenCoinService implements ICoinTokenCoinService {

    @Override
    public List<CoinTokenCoinVO> loadCoinTokenCoin(Map<String, Object> params) {
        return this.daoRouter.query("CoinTokenCoin.loadCoinTokenCoin", params);
    }

    @Override
    public List<CoinTokenCoinVO> loadCoinTokenCoinAll(Map<String, Object> params) {
        return this.daoRouter.query("CoinTokenCoin.loadCoinTokenCoinAll", params);
    }

    @Override
    public CoinTokenCoinVO getCoinTokenCoin(Map<String, Object> params) {
        return this.daoRouter.queryForObject("CoinTokenCoin.loadCoinTokenCoin", params);
    }

    @Override
    public void insertCoinTokenCoin(CoinTokenCoinVO coinTokenCoinVO) {
        this.daoRouter.insert("CoinTokenCoin.insertCoinTokenCoin", coinTokenCoinVO);
    }

    @Override
    public void insertAndUpdateCoinTokenCoinBatch(List<CoinTokenCoinVO> tokenCoinList) {
        for (CoinTokenCoinVO coinTokenCoinVO : tokenCoinList) {
            this.daoRouter.insert("CoinTokenCoin.insertAndUpdateCoinTokenCoin", coinTokenCoinVO);
        }
    }

    @Override
    public void updateCoinTokenCoin(CoinTokenCoinVO coinTokenCoinVO) {
        this.daoRouter.update("CoinTokenCoin.updateCoinTokenCoin", coinTokenCoinVO);
    }

    @Override
    public void deleteCoinTokenCoin(CoinTokenCoinVO coinTokenCoinVO) {
        this.daoRouter.update("CoinTokenCoin.deleteCoinTokenCoin", coinTokenCoinVO);
    }

    @Autowired
    private IDaoRouter daoRouter;

}